import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from "@angular/common/http";
import { UserManageService } from '../../../system-manage/user-manage/user-manage.service'

import { Observable, of } from "rxjs";
@Injectable({
  providedIn: 'root'
})
export class WorkManageService {

  private baseUrl: string = "/api/command"
  constructor(
    private http: HttpClient,
    private userServe: UserManageService
  ) { }
  apiList(data): Observable<any> {
    let _dataJson = {
      params: {
        ...data,
        page : data.page - 1
      }
    }
    return this.http.get(this.baseUrl, _dataJson).pipe();
  }
  //修改
  private editUrl ='/api/command'
  edit(data): Observable<any> {
    let _dataJson = data
    return this.http.put(this.editUrl, _dataJson).pipe();
  }
  private erpDataUrl="/api/command/erp";
  erpData(): Observable<any> {
    let _dataJson = {
    }
    return this.http.get(this.erpDataUrl,_dataJson).pipe();
  }

  //zxh 获取用户树
  getUserTree(){
    return this.userServe.getUserTree().pipe()
  }

}